﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Com.CMS263.BLL;
using Com.CMS263.PO;
using System.Collections.Generic;
using Com.CMS263.Util;

namespace Com.CMS263.Web.manage.ManageRegion
{
    public partial class region_edit : System.Web.UI.Page
    {
        public IList<Region> list = new List<Region>();
        RegionBLL rbll = new RegionBLL();
        public Region entity = new Region();
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(Request["id"]);
            entity = (Region)rbll.FindModelById("Region", id);
            //list = rbll.GetListPaging(0, -1);
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Region region = new Region();
            int id = Convert.ToInt32(Request["hdID"]);
            region = (Region)rbll.FindModelById("Region", id);
            string name = Request["txtName"];
            int order = Convert.ToInt32(Request["txtOrder"]);
            //int father = Convert.ToInt32(Request["selFather"]);
            int best = Convert.ToInt32(Request["chkBest"]);
            region.Name = name;
            region.Regionorder = order;

            //region.Father = father;
            if (region.Father == 0)
            {
                region.IsBest = 0;
            }
            else
            {
                region.IsBest = best;
            }
            rbll.entity = region;
            if (rbll.UpDate())
            {
                StringUtil.Alert("修改成功", "regionList.aspx");
            }
            else
            {
                StringUtil.Alert("修改失败", "-1");
            }
        }
    }
}
